Skip to content

Moduler improvements - #10

Merged
lindentechde merged 48 commits into
mainfrom
moduler-improvements
Oct 12, 2025
Merged

Moduler improvements#10
lindentechde merged 48 commits into
mainfrom
moduler-improvements

Conversation

@Slashmsu

@Slashmsu Slashmsu commented Oct 2, 2025

Copy link
Copy Markdown
Collaborator

🎉 Pull Request

Description

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Configuration/build changes
  • ✅ Test improvements
  • ♻️ Code refactoring (no functional changes)

Related Issue

Fixes #(issue number)

Changes Made

Testing

  • All existing tests pass (npm test)
  • Added new tests for the changes
  • Tested manually with examples
  • Linting passes (npm run lint)
  • Type checking passes (npm run type-check)

Checklist

  • My code follows the project's code style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Context


📋 License Information

SomonScript is open source software licensed under the MIT License.

By submitting this pull request, you agree that your contributions will be licensed under the MIT License.

For contribution guidelines, please review:


Thank you for contributing to SomonScript! 🚀

@github-actions

github-actions Bot commented Oct 2, 2025

Copy link
Copy Markdown

✅ Tests completed on Node.js 20.x: success

@Slashmsu Slashmsu self-assigned this Oct 2, 2025
@github-actions

github-actions Bot commented Oct 2, 2025

Copy link
Copy Markdown

✅ Tests completed on Node.js 20.x: success

@codecov-commenter

codecov-commenter commented Oct 2, 2025

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 73.71429% with 598 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/module-system/module-system.ts 82.28% 113 Missing ⚠️
src/cli/localized-program.ts 0.00% 98 Missing ⚠️
src/parser.ts 73.93% 86 Missing ⚠️
src/codegen.ts 64.08% 65 Missing ⚠️
src/cli/program.ts 74.76% 53 Missing ⚠️
src/error-aggregator.ts 71.42% 46 Missing ⚠️
src/cli/serve.ts 0.00% 38 Missing ⚠️
src/module-system/structured-logger.ts 74.41% 22 Missing ⚠️
src/cli/i18n/translations/ru.ts 11.11% 16 Missing ⚠️
src/cli/i18n/translations/tj.ts 11.11% 16 Missing ⚠️
... and 11 more

📢 Thoughts on this report? Let us know!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines +111 to +118
private validateSystemResources(): void {
const memoryUsage = process.memoryUsage();
// Check heap used instead of total (Node can grow heap dynamically)
const heapUsedMB = Math.round(memoryUsage.heapUsed / 1024 / 1024);
const minRequiredHeap = 10; // 10MB minimum heap used (reasonable for startup)

if (heapUsedMB < minRequiredHeap && memoryUsage.heapTotal < 20 * 1024 * 1024) {
// Only fail if both heap used is tiny AND heap total is < 20MB

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Production validator rejects normal Node processes

The resource check treats a small heap as a failure: it aborts whenever heapUsed < 10MB and heapTotal < 20MB (lines 111‑118). A freshly started Node 20 process typically reports ~4MB heapUsed and ~6MB heapTotal, so running any command with --production will trip this “Insufficient memory available” error even on otherwise healthy machines. Because Node expands the heap on demand, low current usage isn’t evidence of an unhealthy environment. This effectively prevents production mode from ever running. Consider basing the check on available system memory (os.freemem()) or removing it entirely to avoid false positives.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Oct 3, 2025

Copy link
Copy Markdown

✅ Tests completed on Node.js 20.x: success

@github-actions

github-actions Bot commented Oct 4, 2025

Copy link
Copy Markdown

✅ Tests completed on Node.js 20.x: success

@github-actions

github-actions Bot commented Oct 4, 2025

Copy link
Copy Markdown

✅ Tests completed on Node.js 20.x: success

@github-actions

Copy link
Copy Markdown

❌ Tests completed on Node.js 20.x: failure

- Fixed circular dependency warning collection in module loader
- Fixed module cache cleanup test to use correct property name
- Added support for object-to-object type assignment checking
- Enhanced type inference for intersection types
- Fixed parser to handle strict equality operators
- Fixed codegen to handle null/undefined nodes gracefully
- Updated resource limits in production failure tests
- Fixed ESLint no-case-declarations error

Note: Union/intersection type test still requires investigation
@github-actions

Copy link
Copy Markdown

❌ Tests completed on Node.js 20.x: failure

- Fix ResourceLimiter interval cleanup to prevent Jest from hanging
- Add explicit unref() comment for clarity on Node.js exit behavior
- Update intersection type test to use interface syntax instead of inline object types
- Parser currently doesn't support object type literals in type positions

The test suite now properly exits and the type checker test passes.
@github-actions

Copy link
Copy Markdown

✅ Tests completed on Node.js 20.x: success

@github-actions

Copy link
Copy Markdown

✅ Tests completed on Node.js 20.x: success

@github-actions

Copy link
Copy Markdown

✅ Tests completed on Node.js 20.x: success

@github-actions

Copy link
Copy Markdown

❌ Tests completed on Node.js 20.x: failure

@github-actions

Copy link
Copy Markdown

❌ Tests completed on Node.js 20.x: failure

@github-actions

Copy link
Copy Markdown

❌ Tests completed on Node.js 20.x: failure

@github-actions

Copy link
Copy Markdown

❌ Tests completed on Node.js 20.x: failure

@github-actions

Copy link
Copy Markdown

✅ Tests completed on Node.js 20.x: success

…ions

- Add ForOfStatement and ForInStatement AST nodes for enhanced loop support
- Implement arrow function expressions with both expression and block bodies
- Add namespace declarations with IIFE code generation pattern
- Fix parser to accept type keywords as identifiers in for-of/for-in contexts
- Improve method name mapping logic to distinguish user namespaces from built-ins
- Fix string and array method translations while preserving user-defined names

BREAKING CHANGE: Method name mapping now uses context-aware logic

Results: 89% of examples now working (40/45), up from 80%
- Add support for беқимат (undefined) as primitive type
- Fix union types with беқимат in return type annotations
- Add generic type parameter support for type aliases
- Enable qualified type names (Namespace.Type) in type annotations
- Improve parser safety with bounds checking
- Fix function declarations after classes with union return types

These changes bring the compiler from 91% to 95.6% compatibility (43/45 examples working).
The generics example (29-generics.som) now runs completely without errors.
- Fix multi-line function call parsing by adding newline skipping in finishCall()
- Fix multi-line import statement parsing in parseNamedImports()
- Add function expression support for anonymous functions in expression contexts
- Update audit script to compile to source directory for proper module resolution
- Improve parser robustness for real-world multi-line code patterns

This enables proper parsing of code like:
- Multi-line function calls with arguments on separate lines
- Multi-line import statements with named imports
- Anonymous functions as function parameters

Examples working: 41/45 (91%)
@github-actions

Copy link
Copy Markdown

✅ Tests completed on Node.js 20.x: success

@lindentechde
lindentechde merged commit 736d995 into main Oct 12, 2025
6 checks passed
@Slashmsu
Slashmsu deleted the moduler-improvements branch October 12, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants